/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/

#ifndef _IPC_TRANS_CONFIG_H
#define _IPC_TRANS_CONFIG_H

// developer config value ---------------------------------------------------------------------
#include "bst_ipc_config.h"
// #include "ipc_hw_config.h"
/*
 *   define the central monitor end id
 */
#define CENTRAL_MONITOR_END_ID SAFETY_0 // release setting
// #define CENTRAL_MONITOR_END_ID CPU_7 // debug setting

/* state management function enable flag
 * note: you could select which error interrupt message will be notified to trans_layer
 * note: below is full function definition
 */
#ifdef IPC_STATE_MGT_ENABLE
#define MSG_END_MGT_CONFIG                                                     \
	(MSGBX_ECC_RX_MULTIP_EN_BIT | MSGBX_ECC_RX_DETECT_EN_BIT |             \
	 MSGBX_PARITY_HWDATA_EN_BIT | MSGBX_PARITY_HADDR_EN_BIT)
#define MSG_DEF_FLT_MGT_CONFIG                                                 \
	(MSGBX_TX_OVERFLOW_EN_BIT | MSGBX_RX_OVERFLOW_EN_BIT |                 \
	 MSGBX_RX_UNDERFLOW_EN_BIT)
#define MSG_FLT_MGT_CONFIG                                                     \
	(MSGBX_RX_OVERFLOW_EN_BIT | MSGBX_RX_UNDERFLOW_EN_BIT)
#endif

/* buffer size for each session
 * MUST: IF YOU USE THIS MODE, YOUR SERVER SID MUST BE 0
 * note: channel_count * session_count = support max sessions
 */
#ifdef BAREMETAL_VERSION_TRUNCATE
#define SESSION_MSG_BUFFER_COUNT 16
#define SESSION_PACKET_MSG_BUFFER_COUNT 4
#define CHANNEL_COUNT 1 // rw
#define SESSION_COUNT 4 // rw
// #define REMOVE_STS_MGT
#define DEBUG_MODE_ENABLE
#define TIMESTAMP_DEBUG_ENABLE
#else
#define CHANNEL_COUNT 1 // rw
#define SESSION_COUNT 8 // rw
#define SESSION_MSG_BUFFER_COUNT 32
#define SESSION_PACKET_MSG_BUFFER_COUNT 4
// #define ENABLE_MSG_ERR_PROCESS
#define DEBUG_MODE_ENABLE
#define TIMESTAMP_DEBUG_ENABLE
// #define ENABLE_REMOTE_LOG_PROCESS_FUNC
// #define USE_EXTERNAL_MSG_BUFFER
#endif

/* Define the IPC receive mode
 * 1 means interrupt; 2 means polling
 */
#define TRANS_LAYER_RECV_USE_INT
#ifdef TRANS_LAYER_RECV_USE_INT
#define IPC_RECV_MODE 1
#else
#define IPC_RECV_MODE 2
#endif

/* Define the maximum count for session error message processing
 */
#define SESSION_ERR_MSG_PROCESS_MAX_COUNT 512U

#endif
